package com.fooddelivery.Mapper;

import com.fooddelivery.Common.responseVO.OrderDetailVO;
import com.fooddelivery.Entity.TOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.List;

/**
 * <p>
 * 订单表 Mapper 接口
 * </p>
 *
 * @author swy
 * @since 2025-09-09
 */
@Mapper
public interface TOrderMapper extends BaseMapper<TOrder> {

    OrderDetailVO getOrderDetail(Long id);

    List<OrderDetailVO> selectByMonth(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);

    List<OrderDetailVO> person_orderList(String id);

    @Update("update t_order set order_state = 1 where id = #{id}")
    void cancel_order(Long id);

    @Update("update t_order set pay_state = 1,order_state  =2  where id = #{id}")
    void payOrder(TOrder tOrder);
}
